﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Brio.Framework.Operators;

namespace Brio.Framework
{
    public class MusicalOperatorCollection : List<MusicalOperator>
    {
        public MusicalOperatorCollection()
        {
        }


        public void AddOperators()
        {
            Add(new SplitOperator(Settings.SplitOperatorPercentage));
            Add(new JoinOperator(Settings.JoinOperatorPercentage));
            Add(new ViralInjectionOperator(Settings.InjectOperatorPercentage));
            Add(new GaussianNoteMutationOperator(Settings.GaussianMutationPercentage, Settings.GaussianMutationSigma));
            Add(new MelodicSmoothingOperator(Settings.MelodicSmoothingPercentage));
            
            Add(new CrossoverOperator(Settings.CrossoverOperatorPercentage));
        }

        public void Begin(MotifPopulation population)
        {
            // Calculate whether you should apply each musical operator
            // TODO: this is a future idea

            // Decide if it should be applied
            foreach (MusicalOperator musicalOperator in this)
            {
                musicalOperator.PreExecute();
            }
        }

        public void End()
        {
            // Put any post application code here
        }
    }
}
